package com.yb.sys.order.controller;

import com.alibaba.fastjson.JSON;
import com.yb.core.bean.Resp;
import com.yb.sys.order.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/3 13:28
 * FileName: DemoController
 * Description:
 */

@RestController
@RefreshScope
public class DemoController {

    @Autowired
    Person person;

    @Value("${local.server.port}")
    Integer port;

    @RequestMapping("demo")
    public String demo(){
        return JSON.toJSONString(person);
    }


    @GetMapping("port")
    public Resp getPort(){
        return Resp.ok().data(port);
    }
}
